package com.itheima.integer;

public class Demo2 {
    public static void main(String[] args) {
        String s = "10,20,23,1,45";
        //获取字符串长得数
        String[] Arr = s.split(",");
        //再用一个整数数组接收
        int[] arr1 = new int[Arr.length];
        //遍历字符数组
        for (int i = 0; i < Arr.length; i++) {
            //获取每个数组长得元素把他们换为int,用integer.parseInt方法
            int i1 = Integer.parseInt(Arr[i]);
            arr1[i] = i1;
        }
        //最后在遍历这个数组
        for (int i = 0; i < arr1.length; i++) {
            System.out.println(arr1[i]);
        }
    }
}
